#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QPlainTextEdit>
#include <QStyle>
#include "qconfigfile_base.h"
namespace Ui {
    class MainWindow;
}

typedef enum {
    RUS,
    FIN,
    ENG,
    SWE
}QNational;

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

    static const QString C_UCOZ_LINK;
    static const QString C_NAROD_LINK;

private slots:
    void on_pushButton_clicked();

    void on_edMaleFemale_currentIndexChanged(int index);

    void on_edFoldNum_editingFinished();

    void on_cb_m_rus_currentIndexChanged(int index);

    void on_cb_m_fin_currentIndexChanged(int index);

    void on_cb_m_eng_currentIndexChanged(int index);

    void on_btn_copy_rus_clicked();

    void on_btn_copy_fin_clicked();

    void on_btn_copy_eng_clicked();

    void on_btn_ClearDopLinks_clicked();

    void on_btn_ClearAll_clicked();


    void on_rd_ImgPathNarod_toggled(bool checked);

    void on_rd_ImgPathUcoz_toggled(bool checked);


    void on_ed_UcozRootFold_textEdited(QString );

    void on_edNameFin_textEdited(QString );

    void on_edFoldNum_textEdited(QString );

    void on_btnu_cpy_NRus_clicked();

    void on_btnu_cpy_NSwe_clicked();

    void on_btnu_cpy_DR_clicked();

    void on_btnu_cpy_Rost_clicked();

    void on_btnu_cpy_Ves_clicked();

    void on_btnu_cpy_ImgFolder_clicked();

    void on_btnu_cpy_Img1_clicked();

    void on_btnu_cpy_ImgCnt_clicked();

    void on_btnu_cpy_Avatar_clicked();

    void on_btnu_cpy_RusText_clicked();

    void on_btnu_cpy_SweText_clicked();

    void on_btnKK_cpy_Name_clicked();

    void on_btnKK_cpy_Text_clicked();

    void on_btn_CpySh_Varatut_clicked();

    void on_btn_CpySh_Vybrana_clicked();

    void on_btn_CpySh_Vybran_clicked();

    void on_btn_CpySh_NewPhotos_clicked();

    void on_btn_CpySh_OldPhotos_clicked();

    void on_btn_CpySh_NewPhotos_F_clicked();

    void on_btn_CpySh_OldPhotos_F_clicked();

    void on_btn_CpySh_NewPhotos_R_clicked();

    void on_btn_CpySh_OldPhotos_R_clicked();

    void on_btn_CpySh_HappyFin_clicked();

    void on_btn_CpySh_HappyRus_clicked();

    void on_btn_CpySh_Pietari_clicked();

private:
    Ui::MainWindow *ui;

    QConfigFile* cfg_file;

    QString CreateNarodCapt(QNational nation);

    QString CheckGram(const QString& in_str);
    QString ReplaceUml(const QString& in_str);
    QString ReplaceUml_file(const QString& in_str);

    QString AddLink_1(const QString &link, bool blank, bool zpt_before);
    QString AddLink(const QString &l_name,
                    const QStringList &lst,
                    bool blank);

    void CreateStringList_1(QStringList &lst,
                            const QString &link) const;
    void CreateStringList(QStringList &lst,
                          const QString &link1="",
                          const QString &link2="",
                          const QString &link3="",
                          const QString &link4="",
                          const QString &link5="") const;

    QString AddForum_etc(QNational nation);

    QString GeneratePhotoFileName(int imgNum);
    QString GetPhotoPathFor(const QString& root_str);
    QString GetPhotoPathForNarodRu();
    QString GetPhotoPathForUcoz();
    QString GetPhotoPathForKK();
    void GenerateRezPath();

    QString AddImgForNarodRu();
    QString AddImgForKK();
    QString AddImgForUcoz();
    QString AddForum_podp();
    QString AddForum_podp_Ucoz(QNational nation);
    QString AddImgForKK_OneImg(int imgNum);
    QString AddImgForUcoz_OneImg(int imgNum);
    QString CreateKKCapt();

    QString ProcessString(const QString& in_str, bool repl_uml=true);
    QString ProcessText(QPlainTextEdit *edit_in, bool repl_uml,
                        bool first_p); // первый <p>

    QString AddUcozFlag(QNational nation);

    QString CreateNarodText(QNational nation);
    QString CreateKKText();

    QString CreateUcozTex(QNational nation);
    QString CreateUcozTextShort();
    QString CreateUcozTextRusFin();
    QString CreateUcozTextSwe();
    void CreateUcozPesName();
    void CreateUcozD_R_V();

    void ClearDopLinks();
    void ClearAllData();

    QString Create_1_DopLinks(const QString& cur_txt, const QString& link1, const QString& text1);
    QString CreateDopLinksOneNation(const QString& text_beg,
                                       const QString& text_l1,
                                       const QString& text_l2,
                                       const QString& text_l3,
                                       const QString& text_l4,
                                       const QString& text_l5,
                                       const QString& text_end,
                                       bool first_p);// первый <p>
    QString CreateDopLinks(QNational nation,
                                 bool first_p);// первый <p>)

    void GenerateUcozFileNamesAndDirTxt();

};

#endif // MAINWINDOW_H
